<%--
  Created by IntelliJ IDEA.
  User: Lenovo
  Date: 2021/4/8
  Time: 20:14
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
    <%
        pageContext.setAttribute("name1","s1");
        request.setAttribute("name2","s2");
        session.setAttribute("name3","s3");
        application.setAttribute("name4","s4");

        //作用域从底层到高层：page=>request=>session=>application

        String name1 = (String) pageContext.findAttribute("name1");
        String name2 = (String) pageContext.findAttribute("name2");
        String name3 = (String) pageContext.findAttribute("name3");
        String name4 = (String) pageContext.findAttribute("name4");
        String name5 = (String) pageContext.findAttribute("name5");
    %>

    <h1>取出的值为：</h1>
    <h2>${name1}</h2>
    <h2>${name2}</h2>
    <h2>${name3}</h2>
    <h2>${name4}</h2>
    <h2>${name5}</h2>
</body>
</html>
